package com.ssmTmp.api.util;

import com.ssmTmp.api.constant.CommonsConstant;

import java.util.List;

/**
 * @AUthor huangz
 * @Date 2018-10-27 22:08
 * @Description TODO
 **/
public class ListUtils {

    public static boolean isEmpty(List<?> list) {
        return !isNotEmpty(list);
    }

    public static boolean isNotEmpty(List<?> list) {
        if (list != null && list.size() != 0) {
            return true;
        }
        return false;
    }

    /**
     * 将list转为，拼接
     *
     * @param list
     * @return
     */
    public static String listToString(List<String> list) {
        StringBuilder string = new StringBuilder("");
        if (isNotEmpty(list)) {
            for (int i = 0; i < list.size(); i++) {
                string.append(list.get(i));
                if (i != list.size() - 1) {
                    string.append(CommonsConstant.COMMA_SYMBOL);
                }
            }
        }
        return string.toString();
    }

}
